				
                <div id="page-content">
			        <div class="col-sm-12 eq-box-sm">
			        	<div class="panel ">
						    <div class="panel-body">
						        <a id="add" class="btn btn-primary data-toolbar" href="#(ctx)/admin/oa/contract/apply/getEditPage?type=#(type)&view=edit"></i> 添加</a>
						        <div class="col-sm-3" id="searchName">
							    	<input class="form-control" type="text" placeholder="搜索申请人/部门">
							    </div>
							    <div class="col-sm-2" id="searchStartTime">
							    	<div class="input-group date form_datetime col-md-12" style="float:left">
					                    <input class="form-control" type="text" placeholder="开始日期" readonly readonly>
					                    <span class="input-group-addon"><span class="glyphicon glyphicon-th"></span></span>
				                    </div>
							    </div>
							    <div class="col-sm-2" id="searchEndTime">
							    	<div class="input-group date form_datetime col-md-12" style="float:left">
					                    <input class="form-control" type="text" placeholder="结束日期" readonly readonly>
					                    <span class="input-group-addon"><span class="glyphicon glyphicon-th"></span></span>
				                    </div>
							    </div>
							    <div class="col-sm-2" id="controlTable" style="float:right;" onchange="searchTable()">
							    	<div class="select pull-right">
								    	<select class="col-md-12">
		                                    <option value="myApply">我申请的</option>
		                                    <option value="myTask">需要我办理的</option>
		                                    <option value="myHaveDone">已经办理的</option>
		                                    <option value="myCC">我可查看的</option>
		                                </select>
		                            </div>
							    </div>
							    <a id="search" class="btn btn-primary data-toolbar" onclick="searchTable()" href="javascript:void(0);"><i class="demo-pli-add"></i> 搜索</a>
						        <table id="pageTable" class="demo-add-niftycheck" data-toolbar="#add,#searchName,#searchStartTime,#searchEndTime,#search,#controlTable"
						               data-search="true"
						               data-show-refresh="true"
						               data-show-toggle="true"
						               data-show-columns="true"
						               data-sort-name="id"
						               data-page-list="[5, 10, 20]"
						               data-page-size="5"
						               data-pagination="true" data-show-pagination-switch="true" ></table>
						    </div>
						</div>
			        </div>
                </div>
<script>
	
	var col = [{field: 'checked', checkbox : true, align: 'center'},
				{field: 'applyer_name', title: '申请人名称', align: 'center'},
				{field: 'org_name', title: '部门名称', align: 'center'},
				{field: 'title', title: '标题', align: 'center'},
				{field: 'name', title: '合同名', align: 'center'},
				{field: 'type2', title: '合同类型', align: 'center',
					   formatter:function(value,row,index){
						   if(value=="1"){
							   return "买卖";
						   }else if(value=="2"){
							   return "租赁";
						   }else if(value=="3"){
							   return "供用电/水/气";
						   }else if(value=="4"){
							   return "融资租赁合同";
						   }else if(value=="5"){
							   return "技术合同";
						   }else if(value=="6"){
							   return "运输合同及建设工程合同";
						   }
						}
				},
				{field: 'amount_of_money', title: '合同金额', align: 'center'},
				{field: 'contract_num', title: '合同号', align: 'center'},
				{field: 'if_submit', title: '是否提交', align: 'center', width:'80',
				   formatter:function(value,row,index){
					   if(value=="1"){
						   return "<span style='color:green'>已提交</span>";
					   }else{
						   return "未提交";
					   }
				   }
				},
				{field: 'if_complete', title: '是否完成', align: 'center', width:'80',
				   formatter:function(value,row,index){
					   if(value=="1"){
						   return "<span style='color:green'>已完成</span>";
					   }else{
						   return "<span style='color:red'>未完成</span>";
					   }
				   }
				},
				{field: 'if_agree', title: '是否同意', align: 'center', width:'80',
				   formatter:function(value,row,index){
					   if(value=="1"){
						   return "<span style='color:green;'>同意</span>";
					   }else if(value=="2"){
						   return "<span style='color:red;'>未同意</span>";
					   }else{
						   return "<span style='color:gray;'>未知</span>";
					   }
				   }
				},
				{field: 'if_submit', title: '操作', align: 'left', width:'200',
				   formatter:function(value,row,index){
						//通过formatter可以自定义列显示的内容
						//value：当前field的值，即id
						//row：当前行的数据
						var a = '';
						var c = $("#controlTable select").val();
						if(c=="myTask"){
							a = a + '<a class="label label-table label-info" href="javascript:void(0);" onclick="pointLion.openTaskHisListPage(\''+row.proc_ins_id+'\')">流转</a>&nbsp;';
							a = a + '<a class="label label-table label-success" href="'+ctx+'/admin/oa/contract/apply/getEditPage?id='+row.id+'&view=detail&type=#(type)" >查看</a>&nbsp;';
							a = a + '<a class="label label-table label-info" onclick="doTask(\''+row.TASKID+'\',\''+row.id+'\',\''+row.DEFKEY+'\')" href="javascript:void(0);" >办理</a>&nbsp;';
						}else if(c=="myHaveDone"){
							a = a + '<a class="label label-table label-info" href="javascript:void(0);" onclick="pointLion.openTaskHisListPage(\''+row.proc_ins_id+'\')">流转</a>&nbsp;';
							a = a + '<a class="label label-table label-info" target="_blank" href="#(ctx)/admin/oa/workflow/flowimg/getFlowImg?processInstanceId='+row.proc_ins_id+'" >流程2</a>&nbsp;';
							a = a + '<a class="label label-table label-success" href="'+ctx+'/admin/oa/contract/apply/getEditPage?id='+row.id+'&view=detail&type=#(type)" >查看</a>&nbsp;';
						}else if(c=="myCC"){
							a = a + '<a class="label label-table label-info" href="javascript:void(0);" onclick="pointLion.openTaskHisListPage(\''+row.proc_ins_id+'\')">流转</a>&nbsp;';
							a = a + '<a class="label label-table label-info" target="_blank" href="#(ctx)/admin/oa/workflow/flowimg/getFlowImg?processInstanceId='+row.proc_ins_id+'" >流程2</a>&nbsp;';
							a = a + '<a class="label label-table label-success" href="'+ctx+'/admin/oa/contract/apply/getEditPage?id='+row.id+'&view=detail&type=#(type)" >查看</a>&nbsp;';
						}else{
						   if(value=='0'){//未提交
								a = a + '<a class="label label-table label-info" onclick="startProcess(\''+row.id+'\',\''+row.def_key+'\')" href="javascript:void(0);" >提交</a>&nbsp;';
								a = a + '<a class="label label-table label-success" href="'+ctx+'/admin/oa/contract/apply/getEditPage?id='+row.id+'&view=detail&type=#(type)" >查看</a>&nbsp;';
								a = a + '<a class="label label-table label-success" href="'+ctx+'/admin/oa/contract/apply/getEditPage?id='+row.id+'&view=edit&type=#(type)" >编辑</a>&nbsp;';
								a = a + '<a class="label label-table label-danger" onclick="del(\''+row.id+'\')" href="javascript:void(0);" >删除</a>';
						   }else{
							   a = a + '<a class="label label-table label-info" href="javascript:void(0);" onclick="pointLion.openTaskHisListPage(\''+row.proc_ins_id+'\')">流转</a>&nbsp;';
							   a = a + '<a class="label label-table label-success" href="'+ctx+'/admin/oa/contract/apply/getEditPage?id='+row.id+'&view=detail&type=#(type)" >查看</a>&nbsp;';
							   if(row.if_complete=="0"){
								   a = a + '<a class="label label-table label-danger" href="javascript:void(0);" onclick="callBack(\''+row.id+'\')" >撤回</a>&nbsp;';

							   }
						   }
						}

					   return a;

				   }
				}];
	var opt = {
		    //请求方法
			   method: 'get',
			    //是否显示行间隔色
			   striped: true,
			   //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）     
			   cache: false,  
			   //data-toolbar: "#demo-delete-row",
			   //是否显示分页（*）  
			   pagination: true,   
			    //是否启用排序  
			   sortable: false,    
			    //排序方式 
			   sortOrder: "asc",    
			   //初始化加载第一页，默认第一页
			   //我设置了这一项，但是貌似没起作用，而且我这默认是0,- -
			   //pageNumber:1,   
			   //每页的记录行数（*）   
			   pageSize: 10,  
			   //可供选择的每页的行数（*）    
			   pageList: [10, 25, 50, 100],
			   //这个接口需要处理bootstrap table传递的固定参数,并返回特定格式的json数据  
			   url: ctx+"/admin/oa/contract/apply/listData",
			   //默认值为 'limit',传给服务端的参数为：limit, offset, search, sort, order Else
			   //queryParamsType:'',   
			   ////查询参数,每次调用是会带上这个参数，可自定义                         
			   queryParams : function(params) {
			       return {
			             pageNumber: (params.offset/params.limit)+1,
			             pageSize: params.limit,
			             type:'#(type)'
			           };
			   },
			   //分页方式：client客户端分页，server服务端分页（*）
			   sidePagination: "server",
			   //是否显示搜索
			   search: false,  
			   //Enable the strict search.    
			   strictSearch: true,
			   //Indicate which field is an identity field.
			   idField : "id",
			   columns: col,
			   pagination:true,paginationShowPageGo: true
			}; 
		
	//表格
	function initTable(){
		$('#pageTable').bootstrapTable(opt);
		$('#pageTable').bootstrapTable('hideColumn', 'id');
	}
	function refreshTable(){
		$("#pageTable").bootstrapTable('refresh', opt);
		$('#pageTable').bootstrapTable('hideColumn', 'id');
	}
	
	//批量删除
	function delSel(){
		var data = [];
		$("#pageTable input[type='checkbox'][name!='btSelectAll']:checked").each(function(){
			data.push($(this).val());
		});
		if(data.length==0){
			pointLion.alertMsg("请选择要删除的数据!","danger",null,null);
			return;
		}
		del(data.join(","));//执行删除
	}
	//删除
	function del(ids){
		pointLion.confimMsg("您是否要删除所选信息 ?<br/> 点击确认进行删除 , 点击取消取消该操作",null,function(){
			//执行删除
			var data = common_ajax.ajaxFunc("/admin/oa/contract/apply/delete",{"ids":ids}, "json", null);
			//删除结果
			if(data.success){
				pointLion.alertMsg(data.message,"success",null,function(){
					location.href = ctx+'/admin/oa/contract/apply/getListPage?type=#(type)';//跳转到列表页
				});
			}else{
				pointLion.alertMsg(data.message,"success",null,null);
			}
		});
	};
	//查询
	function searchTable(){
		var name = $("#searchName input").val();
        var startTime = $("#searchStartTime input").val();
        var endTime = $("#searchEndTime input").val();
        var c = $("#controlTable select").val();
        var param = {
    		query: {
    		         "startTime":startTime,
    		         "endTime":endTime,
    		         "name":encodeURIComponent(name),
    		         "c":c
          	}
        }
        // 刷新表格
        $('#pageTable').bootstrapTable('refresh',param);
	}
	//提交，启动流程
	function startProcess(id){
			pointLion.confimMsg("您将要提交该单据！并且启动流程<br/><span style='color:green;'>您将无法进行修改和删除！！！</span> <br/>点击确认进行提交 , 点击取消取消该操作",null,function(){
				var data = common_ajax.ajaxFunc("/admin/oa/contract/apply/startProcess?type=#(type)",{"id":id}, "json", null);
				if(data.success){
					pointLion.alertMsg(data.message,"success",null,function(){
						location.href = ctx+'/admin/oa/contract/apply/getListPage?type=#(type)';//跳转到列表页
					});
				}else{
					pointLion.alertMsg(data.message,"danger",null,null);
				}
			});
	}
	//撤回
	function callBack(id){
		pointLion.confimMsg("您将要撤回该单据流程！<br/><span style='color:red;'>该操作将取回单据，您将可以对单据进行修改，并可将单据重新送交审批。</span> <br/>点击确认进行撤回单据 , 点击取消取消该操作",null,function(){
			//执行删除
			var data = common_ajax.ajaxFunc("/admin/oa/contract/apply/callBack",{"id":id}, "json", null);
			//删除结果
			if(data.success){
				pointLion.alertMsg(data.message,"success",null,function(){
					location.href = ctx+'/admin/oa/contract/apply/getListPage?type=#(type)';//跳转到列表页
				});
			}else{
				pointLion.alertMsg(data.message,"danger",null,null);
			}
		});
	}
	$(document).ready(function(){
		$('.form_datetime').datepicker({format: 'yyyy-mm-dd',weekStart: 1,todayBtn:  1,autoclose: 1,language:  'zh-CN',todayHighlight: 1,forceParse: 0,clearBtn: true }).on('changeDate',null);
		
		initTable();//初始化
	});
</script>